<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		.box{
			width: 300px;
			height: 300px;
			background-color: gold;
		}
	</style>
	<script type="text/javascript">
		window.onload=function () {
			// body...
			var oBtn = document.getElementById("btn");
			var oDiv = document.getElementById("box01");
			alert(oDiv.style.display)
			oBtn.onclick = function(){
				if(oDiv.style.display=="none"){
					oDiv.style.display = "block";
				}
				else{
					oDiv.style.display = "none";
				}
			}

		}
	</script>
</head>
<body>
	<input type="button" name="" value="切换" id="btn">
	<div class="box" id="box01"></div>
</body>
</html>